Add a hover-help for the Options field which explains interpolation.

Akinori MUSHA 10 years ago
parent
commit
00514d2ca5

+ 1 - 1
app/assets/javascripts/application.js.coffee.erb

@@ -68,7 +68,7 @@ $(document).ready ->
68 68
     setTimeout((-> $(".flash").slideUp(-> $(".flash").remove())), 5000)
69 69
 
70 70
   # Help popovers
71
-  $('.hover-help').popover(trigger: 'hover')
71
+  $('.hover-help').popover(trigger: 'hover', html: true)
72 72
 
73 73
   # Agent Navigation
74 74
   $agentNavigate = $('#agent-navigate')

+ 6 - 0
app/assets/stylesheets/application.css.scss.erb

@@ -156,6 +156,12 @@ span.not-applicable:after {
156 156
   top: 2px;
157 157
 }
158 158
 
159
+.popover {
160
+  dd {
161
+    margin-left: 1em;
162
+  }
163
+}
164
+
159 165
 h2 .scenario, a span.label.scenario {
160 166
   position: relative;
161 167
   top: -2px;

+ 1 - 0
app/views/agents/_form.html.erb

@@ -77,6 +77,7 @@
77 77
         <div class="col-md-12">
78 78
           <div class="form-group">
79 79
             <%= f.label :options %>
80
+            <span class="glyphicon glyphicon-question-sign hover-help" data-content="In this JSON hash, interpolation is available in almost all values using the Liquid templating language.<p>Available template variables include the following:<dl><dt><code>message</code>, <code>url</code>, etc.</dt><dd>Refers to the corresponding key's value of each incoming event's payload.</dd><dt><code>agent</code></dt><dd>Refers to the agent that created each incoming event.  It has attributes like <code>type</code>, <code>name</code> and <code>options</code>, so <code>{{agent.type}}</code> will expand to <code>WebsiteAgent</code> if an incoming event is created by that agent.</dd></dl></p><p>To access user credentials, use the <code>credential</code> tag like this: <code>{% credential <em>bare_key_name</em> %}</code></p>"></span>
80 81
             <textarea rows="15" id="agent_options" name="agent[options]" class="form-control live-json-editor <%= (@agent.new_record? && @agent.options == {}) ? "showing-default" : "" %>">
81 82
               <%= Utils.jsonify((@agent.new_record? && @agent.options == {}) ? @agent.default_options : @agent.options) %>
82 83
             </textarea>